package com.example.qaplatform.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.qaplatform.entity.HistoryEntity;
import com.example.qaplatform.repository.HistoryRepository;

@RestController
@RequestMapping("/api/history")
public class HistoryController {
    @Autowired
    private HistoryRepository historyRepository;

    @GetMapping("/list/{userId}")
    public List<HistoryEntity> list(@PathVariable Long userId) {
        return historyRepository.findByUserIdOrderByCreateTimeDesc(userId);
    }
} 